#include "hiding.h"
#include <string.h>


void showRelevance(int relv[]) {
    int i;
    for(i = 0; i < 32; i++) printf("%d ", relv[i]);
    printf("\n");
}

int main(int argc, char *argv[]) {

    if(argc != 2) {
        printf("specify the image file...\n");
        exit(0);
    }

    srand(time(NULL));

    FILE *image = fopen(argv[1], "rb");

    if(image == NULL) { printf("file error\n"); exit(0); }

    UCHAR raw[DEGREE][DEGREE];
    readImage(image, raw);

    UCHAR pos[DEGREE][DEGREE]; memcpy(pos, raw, sizeof(raw)); pos_reverse(pos);
    UCHAR neg[DEGREE][DEGREE]; memcpy(neg, raw, sizeof(raw)); neg_reverse(neg);

    int raw_relv[BLOCK_CNT] = {0};
    getRelevance(raw, raw_relv);

    int pos_relv[BLOCK_CNT] = {0};
    getRelevance(pos, pos_relv);
    double pos_rm = getRm(raw_relv, pos_relv);

    int neg_relv[BLOCK_CNT] = {0};
    getRelevance(neg, neg_relv);
    double neg_rm = getRm(raw_relv, neg_relv);

    
    printf("Rm+: %llf Rm-: %llf\n", pos_rm, neg_rm);

    return 0;
}